import request from '@/config/axios'

export interface RuleManageVO {
  id: number
  name: string
  status: number
  description: string
  creator: number
  createTime: Date
  metadataRatio: number
  resourceStateRatio: number
  dataProcessRatio: number
}

// 查询列表
export const getRuleManagePage = (params: PageParam) => {
  return request.get({ url: '/rule/page', params })
}

// 查询详情
export const getRuleManage = (id: number) => {
  return request.get({ url: '/rule/get?id=' + id })
}

// 新增
export const createRuleManage = (data: RuleManageVO) => {
  return request.post({ url: '/rule/create', data })
}

// 删除
export const deleteRuleManage = (id: number) => {
  return request.delete({ url: '/rule/delete?id=' + id })
}

// 修改
export const updateRuleManage = (data: RuleManageVO) => {
  return request.put({ url: '/rule/update', data })
}

// 状态修改
export const updateRuleManageStatus = (id: number, status: number) => {
  const data = {
    id,
    status
  }
  return request.put({ url: '/rule/update-status', data: data })
}
